<?php
/*
 * 搜索检测类
 * @author  Mark
 * @package ixdcw
 * @file    
 * @time    13-4-17 下午4:43
 */
 
class SearchCheck
{
	public static function length($kw)
	{
		$DT = $GLOBALS['DT'];
		include load('search.lang');

		if (strlen($kw) < $DT['min_kw'] || strlen($kw) > $DT['max_kw']) {
			Prompt::message(lang($L['word_limit'], array($DT['min_kw'], $DT['max_kw'])), Env::referer());
		}
	}

	public static function timeLimit()
	{
		$DT = $GLOBALS['DT'];
		$page = $GLOBALS['page'];
		$DT_TIME = $GLOBALS['DT_TIME'];
		if ($DT['search_limit'] && $page == 1 && getenv("HTTP_REFERER")) {
			if (($DT_TIME - $DT['search_limit']) < Cookie::get('last_search')) {
				Prompt::message(lang($L['time_limit'], array($DT['search_limit'])), Env::referer());
				Cookie::set('last_search', $DT_TIME);
			}
		}
	}
}